home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
aie8911.zip
/
LISTING.7
< prev
next >
Wrap
Text File
|
1989-08-28
|
972b
|
38 lines
Listing 6
TRANSFORMATION TO COMPLETED ACTION
done_it_prompt( Command, Done ) :-
action( Command, Action),
!,
object( Command, Object),
!,
singular( Object, S_object),
!,
past( Action, Past),
!,
concat([S_object, $ $, Past,$.$], Done).
% find past form of verb given present
past( Action, Past) :-
list_text( List, Action), !,
reverse( List, List1), !,
past_hlpr( List1, List2), !,
reverse( List2, List3), !,
list_text( List3, Past).
past_hlpr( [`s, `e | T] , [`d, `e | T] ) :- !.
past_hlpr( [ `e | T] , [`d, `e | T] ) :- !.
past_hlpr( T , [`d, `e | T] ) :- !.
singular( Plural, Singular) :-
string_length( Plural, N),
M is N-1 ,
nth_char(M, Plural, `s),
substring( Plural , 0, M, Singular).
---------------- end of listing -----------------------------------